Skip to content

Conversation

@thoroc
Copy link
Contributor

@thoroc thoroc commented Dec 9, 2025

Summary

Implements automated GitHub Actions workflow to validate repository settings and ensure organizational standards are maintained.

Changes

Workflow ()

  • Schedule: Runs weekly on Monday at midnight UTC to detect configuration drift
  • Manual dispatch: Allows ad-hoc checks via workflow_dispatch
  • Permissions: for settings, for issue management

Script ()

TypeScript script that performs three checks:

  1. ✅ Default branch is main
  2. ✅ Branch protection is enabled on main
  3. ✅ Automatic branch deletion after merge is enabled

Features

  • Automated issue management: Creates/updates/closes GitHub issues based on check results
  • Retry logic: Exponential backoff (1s, 2s, 3s) for transient API failures
  • Smart error handling:
    • Exit 0 for check failures (informational only)
    • Exit 1 for script errors (workflow failures)
    • No retry on 403 Forbidden errors
  • GitHub Actions summary: Clear reporting with remediation steps
  • Local testing: Can run with bun run check:repo-settings

Dependencies

  • Added @octokit/rest@^20.0.0 for GitHub API interactions
  • Added check:repo-settings npm script for convenience

Testing

Verified locally:

  • Script correctly validates environment variables
  • TypeScript compiles without errors
  • Workflow YAML syntax is valid
  • Pre-commit hooks pass (format, lint, type-check, build)

References

  • Feature document: .context/features/check-repo-branch-settings.md
  • Follows existing workflow patterns (e.g., validate-pr.yml)
  • Uses Bun + TypeScript for consistency with project standards

Implement automated GitHub Actions workflow to validate repository settings:
- Check default branch is 'main'
- Verify branch protection is enabled on 'main'
- Confirm automatic branch deletion after merge is enabled

Features:
- Scheduled weekly checks (Monday midnight UTC)
- Manual dispatch option for ad-hoc verification
- Automated GitHub issue creation/update/closure
- Retry logic with exponential backoff for transient failures
- GitHub Actions summary with remediation steps
- Local testing support with bun

Implementation:
- TypeScript script using @octokit/rest for GitHub API
- Read-only verification (never modifies settings)
- Idempotent issue handling to avoid duplicates
- Exit 0 for check failures, exit 1 for script errors

Ref: .context/features/check-repo-branch-settings.md
@thoroc thoroc merged commit f79f9f0 into main Dec 9, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants